<?php
	/**
		Processes registration
		
		@author Joseph Fehrman
	*/

	$username = $_POST['username'];
	$password = $_POST['password'];
	$hashPass = hash('sha256', $password);
	include_once("../db/connection.php");


	//Query to add user to the database
	$sql = "INSERT INTO users (username, password) values ('$username', '$hashPass')";
	mysqli_query($conn, $sql) OR die("Error on query: " . $sql);
	
	mysqli_close($conn);
	//redirect to login page for user to log in
	header("Location: ../login.php");
?>